﻿// <copyright file="IConnexityBuffer.cs" company="Ecole Normale Supérieure">
// Released under GPLv2
// </copyright>
// <summary>Contains the IConnexityBuffer Interface</summary>

namespace Sqwarea.GameLogic.Connexity
{
    using System.Drawing;
    using Sqwarea.Persistence;

    /// <summary>
    /// Interface of a buffer for ConnexityProvider.
    /// Gives the impression of a square by square access, 
    /// while getting loads of square behind the scene.
    /// </summary>
    public interface IConnexityBuffer : ISquareProvider
    {
        /// <summary>
        /// Gives an access to the neighbours of a given position
        /// </summary>
        /// <param name="position">The position whose neighbours are asked for</param>
        /// <returns>A IEnumerable of the neighbours squares</returns>
        NeighbourSquares GetNeighbours(Point position);

        /// <summary>
        /// Gives an access to the neighbours of a given square
        /// </summary>
        /// <param name="square">The square whose neighbours are asked for</param>
        /// <returns>A IEnumerable of the neighbours squares</returns>
        NeighbourSquares GetNeighbours(Square square);

        /// <summary>
        /// Update the information on the square defined by its internal position
        /// </summary>
        /// <param name="square">Square to update (containing position)</param>
        void UpdateSquare(Square square);

        /// <summary>
        /// Sends all the modification done to the squares to the IGameProvider.
        /// Very important : if not used, UpdateSquare does nothing !
        /// </summary>
        void Commit();
    }
}
